<template>
  <v-card>
    <v-card-title> 权威信息来源 </v-card-title>
    <v-list-item
    color="blue"
      v-for="(institute, i) in institutes"
      :key="i"
      @click="goto(institute.link)"
      style="color: #2894ff; font-size: 20px; margin-top: 5px"
    >
      {{ institute.name }}
    </v-list-item>
  </v-card>
</template>

<script>
export default {
  data: () => ({
    institutes: [
      {
        name: "国家卫生健康委员会",
        link: "http://www.nhc.gov.cn/xcs/xxgzbd/gzbd_index.shtml",
      },
      {
        name: "世界卫生组织",
        link: "https://www.who.int/zh/emergencies/diseases/novel-coronavirus-2019",
      },
      {
        name: "丁香园",
        link: "https://ncov.dxy.cn/",
      },
    ],
  }),
  name: "InfoSource",
  mounted() {
    this.loadofficial();
  },
  methods: {
    goto(url) {
      window.open(url, "_blank"); // 新窗口打开外链接
    },
    loadofficial: function () {
      this.$api.fireeye
        .GetOfficial()
        .then((res) => {
          let result = res;
          if (result.success) {
            this.institutes = result.data;
          } else {
            this.$Message.error("权威机构请求失败,原因" + result.exc);
          }
        })
        .catch(function (error) {
          console.log(error);
          this.$Message.error("请求权威机构失败,出现了意料之外的错误");
        });
    },
  },
};
</script>

<style scoped>
</style>